<?php
/* $Id$ */
/*
    index.php
	Copyright (C) 2009 Wang Zhongliang <wzlsh629@163.com>.
	All rights reserved.

    Copyright (C) 2004, 2005 Scott Ullrich
    All rights reserved.

    Originally part of m0n0wall (http://m0n0.ch/wall)
    Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
    All rights reserved.

    Redistribution and use in source and binary forms, with or without
    modification, are permitted provided that the following conditions are met:

    1. Redistributions of source code must retain the above copyright notice,
       this list of conditions and the following disclaimer.

    2. Redistributions in binary form must reproduce the above copyright
       notice, this list of conditions and the following disclaimer in the
       documentation and/or other materials provided with the distribution.

    THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
    AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
    AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
    oR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    POSSIBILITY OF SUCH DAMAGE.
*/

##|+PRIV
##|*IDENT=page-system-login/logout
##|*NAME=System: Login / Logout page
##|*DESCR=Allow access to the 'System: Login / Logout' page.
##|*MATCH=index.php*
##|-PRIV


	## Load Essential Includes
	require_once('guiconfig.inc');
	require_once('notices.inc');

	## Load Functions Files
	require_once('includes/functions.inc.php');

	## If it is the first time webConfigurator has been
	## accessed since initial install show this stuff.
//	if(file_exists("{$g['conf_path']}/trigger_initial_wizard")) {
//
//
//		echo <<<EOF
//<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
//	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
//<html>
//<head>
//	<title>pfSense.local - pfSense first time setup</title>
//	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
//	<link rel="stylesheet" type="text/css" href="/niftycssprintCode.css" media="print" />
//	<script type="text/javascript">var theme = "nervecenter"</script>
//	<script type="text/javascript" src="/themes/nervecenter/loader.js"></script>
//		
//EOF;
//
//		echo "<body link=\"#0000CC\" vlink=\"#0000CC\" alink=\"#0000CC\">\n";
//
//		if(file_exists("/usr/local/www/themes/{$g['theme']}/wizard.css")) 
//			echo "<link rel=\"stylesheet\" href=\"/themes/{$g['theme']}/wizard.css\" media=\"all\" />\n";
//		else 
//			echo "<link rel=\"stylesheet\" href=\"/themes/{$g['theme']}/all.css\" media=\"all\" />";
//
//		echo "<form>\n";
//		echo "<center>\n";
//		echo "<img src=\"/themes/{$g['theme']}/images/logo.gif\" border=\"0\"><p>\n";
//		echo "<div \" style=\"width:700px;background-color:#ffffff\" id=\"nifty\">\n";
//		echo "Welcome to {$g['product_name']}!<p>\n";
//		echo "One moment while we start the initial setup wizard.<p>\n";
//		echo "Embedded platform users: Please be patient, the wizard takes a little longer to run than the normal GUI.<p>\n";
//		echo "To bypass the wizard, click on the {$g['product_name']} logo on the initial page.\n";
//		echo "</div>\n";
//		echo "<meta http-equiv=\"refresh\" content=\"1;url=wizard.php?xml=setup_wizard.xml\">\n";
//		echo "<script type=\"text/javascript\">\n";
//		echo "NiftyCheck();\n";
//		echo "Rounded(\"div#nifty\",\"all\",\"#AAA\",\"#FFFFFF\",\"smooth\");\n";
//		echo "</script>\n";
//		exit;
//	}


	## Find out whether there's hardware encryption or not
	unset($hwcrypto);
	$fd = @fopen("{$g['varlog_path']}/dmesg.boot", "r");
	if ($fd) {
		while (!feof($fd)) {
			$dmesgl = fgets($fd);
			if (preg_match("/^hifn.: (.*?),/", $dmesgl, $matches) or preg_match("/^safe.: (.*?),/", $dmesgl, $matches) or preg_match("/^ubsec.: (.*?),/", $dmesgl, $matches) or preg_match("/^padlock.: (.*?),/", $dmesgl, $matches) or preg_match("/^glxsb.: (.*?),/", $dmesgl, $matches)) {
				$hwcrypto = $matches[1];
				break;
			}
		}
		fclose($fd);
	}

if(file_exists("/usr/bin/uname")) {
	$hostname = `/usr/bin/uname -n`;
}

if(file_exists("{$g['etc_path']}/version")) {
	$version = file_get_contents("{$g['etc_path']}/version") . ' based on ' . `uname -sr`;
}

## Set Page Title and Include Header
$pgtitle = array("系统信息", "基本信息");
include("head.inc");
?>

<?php
include("fbegin.inc");
?>
<div class="soft_cont_right_table">
<table width="100%" cellspacing="0" cellpadding="6" border="0" align="center">
	<tr>
		<td class="listtopic" colspan="2">基本信息</td>
	</tr>
	<tr>
		<td class="vncell" width="22%">主机名</td>
		<td class="vtable" width="78%"><?php echo $hostname; ?></td>
	</tr>
	<tr>
		<td class="vncell" width="22%">版本号</td>
		<td class="vtable" width="78%"><?php echo '网务通 ', $version; ?></td>
	</tr>
</table>
<br>
<table width="100%" cellspacing="0" cellpadding="6" border="0" align="center">
    <tr>
        <td class="listtopic" colspan="2">常用功能</td>
    </tr>
    <tr>
        <td class="vtable" style="height:20px;line-height:20px;"><a href="/interfaces.php?if=wan">+ WAN设置</a></td>
        <td class="vtable"><a href="/firewall_software.php">+ 软件过滤</a></td>
    </tr>
    <tr>
        <td class="vtable" width="50%" style="height:20px;line-height:20px;"><a href="/firewall_nat.php">+ 端口转发</a></td>
        <td class="vtable" width="50%"><a href="/squid_history.php">+ 上网记录</a></td>
    </tr>
    <tr>
        <td class="vtable" width="50%" style="height:20px;line-height:20px;"><a href="/traffic_monitor.php">+ 流量监控</a></td>
        <td class="vtable" width="50%"><a href="/traffic_limit.php">+ 流量限制</a></td>
    </tr>
    <tr>
        <td class="vtable" width="50%" style="height:20px;line-height:20px;"><a href="/system_usermanager.php">+ 用户管理</a></td>
        <td class="vtable" width="50%"><a href="/status_services.php">+ 服务状态</a></td>
    </tr>
    <tr>
        <td class="vtable" width="50%" style="height:20px;line-height:20px;"><a href="/client_list.php">+ 局域网用户</a></td>
        <td class="vtable" width="50%"><a href="/diag_dump_states.php">+ 状态表</a></td>
    </tr>
    <tr>
        <td class="vtable" width="50%" style="height:20px;line-height:20px;"><a href="/reboot.php">+ 重启</a></td>
        <td class="vtable" width="50%"><a href="/halt.php">+ 关机</a></td>
    </tr>
</table>

</div>

<?php include("fend.inc"); ?>

</body>
</html>